package com.sunshine.spring.jdbc.dao;

import com.sunshine.spring.jdbc.model.Customer;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * main方法类
 * @Author: WeiHong
 * @Date: 2017/3/16 15:21
 */
public class App {

    public static void main(String[] args) {
        ApplicationContext ctx = new ClassPathXmlApplicationContext("/spring/spring-jdbc.xml");
        CustomerDaoImpl dao = (CustomerDaoImpl) ctx.getBean("customerDao");
        //插入数据
        //Customer customer = new Customer(1, "test" , 20);
        //dao.insert(customer);

        //查询
        Customer customer = dao.findByCustomerId(1);
        System.out.println(customer.toString());
    }
}
